package com.fs.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.fs.domain.ServeProvider;
import com.fs.service.IServeProviderService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 服务人员信息管理Controller
 *
 * @author zh
 * @date 2024-10-19
 */
@RestController
@RequestMapping("/provider/provider")
public class ServeProviderController extends BaseController {
    @Autowired
    private IServeProviderService serveProviderService;

    /**
     * 查询服务人员信息管理列表
     */
    // @PreAuthorize("@ss.hasPermi('provider:provider:list')")
    @GetMapping("/list")
    public TableDataInfo list(ServeProvider serveProvider) {
        startPage();
        List<ServeProvider> list = serveProviderService.selectServeProviderList(serveProvider);
        return getDataTable(list);
    }


    /**
     * 获取服务人员信息管理详细信息
     */
    // @PreAuthorize("@ss.hasPermi('provider:provider:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(serveProviderService.selectServeProviderById(id));
    }

    /**
     * 修改服务人员信息管理
     */
    // @PreAuthorize("@ss.hasPermi('provider:provider:edit')")
    @Log(title = "服务人员信息管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ServeProvider serveProvider) {
        return toAjax(serveProviderService.updateServeProvider(serveProvider));
    }
}
